
import CryptoJS  from "@/Grace6/js/crypto-js.js"
export default {
  /**
   * 产生签名
   * @param arr2
   * @returns {string}
   */
  sign(obj) {  	
			
    let key = CryptoJS.enc.Hex.parse('e2f29cb8df39a368e2f29cb8df39a368');
    let iv = CryptoJS.enc.Hex.parse('5e92442523d44e7c167fcc6f98d40157');
    let arr2 = new Array()
	
    for (var j in obj) {
		
      arr2.push(j);
    }	
    arr2.sort();
    var str = "";
    for (var i = 0; i < arr2.length; i++){
      str += arr2[i] + "=" + obj[arr2[i]]+"&";
    }
    str = str.substring(0, str.length - 1);
	console.log(key,iv);
    console.log("sign",str);
    str = CryptoJS.AES.encrypt(str, key, {
      iv: iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    });
	console.log("sing",str);
    return str;
  }
}